/*
 * @Author: hcluo
 * @Date: 2020-08-27 17:24:39
 * @LastEditors: hcluo
 * @LastEditTime: 2020-08-28 13:06:04
 * @Description:
 */
import React, { forwardRef, useEffect } from 'react';
import ReactEchartsCore from 'echarts-for-react/lib/core';
// import * as echarts from 'echarts/lib/echarts';
import * as echarts from 'echarts';
import registerTheme from './eChartTheme';
// import 'echarts/lib/component/dataset';
// import 'echarts/lib/chart/line';
// import 'echarts/lib/chart/bar';
// import 'echarts/lib/chart/scatter';
// import 'echarts/lib/chart/pie';
// import 'echarts/lib/chart/treemap';
// import 'echarts/lib/chart/map';
// import 'echarts/map/js/china';
// import 'echarts/lib/component/graphic';
// import 'echarts/lib/component/grid';
// import 'echarts/lib/component/legendScroll';
// import 'echarts/lib/component/tooltip';
// import 'echarts/lib/component/axisPointer';
// import 'echarts/lib/component/title';
// import 'echarts/lib/component/dataZoom';
// import 'echarts/lib/component/visualMap';
// import 'echarts/lib/component/markPoint';
// import 'echarts/lib/component/markLine';
// import 'echarts/lib/component/markArea';
// import 'echarts/lib/component/geo';
// registerTheme(echarts);
window.echarts = echarts;
// import * as echarts from 'echarts/lib/echarts';
/**
 * 中文文档： https://www.jianshu.com/p/f6c1c4618c22
 */
const MyChart = forwardRef((props, ref) => {
  return <ReactEchartsCore ref={ref} echarts={echarts} {...props} />;
});

MyChart.propTypes = {};
MyChart.defaultProps = {
  style: {
    width: '100%',
    height: '100%',
  },
  opts: {
    // renderer: 'svg',
  },
  theme: 'windTheme',
  notMerge: true,
  lazyUpdate: false,
  showLoading: false,

  option: {},
};

export default MyChart;
